<?php
declare (strict_types=1);

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * @property bool $type 类型:1=精品区,2=优选区,3=店铺
 * @property int $deletetime
 * @property int $id
 * @property int $pro_id
 * @property int $user_id
 * @property string $createtime
 * @method static \think\db\Query onlyTrashed()
 * @method static \think\db\Query withTrashed()
 * @mixin \think\Model
 */
class UserCollect extends Model
{
	use SoftDelete;
	
	protected $createTime = 'createtime';
	protected $updateTime = 'updatetime';
	protected $deleteTime = 'deletetime';
	
	
	function goods()
	{
		return $this->belongsTo(Goods::class,'pro_id');
	}
	
	function info()
	{
		return $this->morphTo(['type', 'pro_id'], [
			1 => 'app\model\Goods',
			2 => 'app\model\Super',
			3 => 'app\model\Shop',
		]);
	}
}
